package hz.mobileproject.pda.callroll.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.Arrays;
import java.util.List;

import hz.mobileproject.pda.R;
import hz.mobileproject.pda.ui.activity.work.CallRecordActivity;

public class AddCallRecordCallActivity extends AppCompatActivity {

    private Banner mBanner;
    //开始电子点名
    private TextView mStartRollCall;
    //点名记录
    private LinearLayout ll_coll_jilu;
    private LinearLayout ll_addrecordcall_2;
    private LinearLayout ll_addrecordcall_3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_call_record_call);

        initView();
        initData();
        initThing();
    }




    private void initView() {
        mBanner = (Banner) findViewById(R.id.banner);
        mStartRollCall = (TextView) findViewById(R.id.tv_rollcall_start);
        ll_coll_jilu = (LinearLayout) findViewById(R.id.ll_coll_jilu);
        ll_addrecordcall_2 = (LinearLayout) findViewById(R.id.ll_addrecordcall_2);
        ll_addrecordcall_3 = (LinearLayout) findViewById(R.id.ll_addrecordcall_3);
    }


    private void initData() {
        //设置图片加载器
        mBanner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        Integer[] int_image = {R.drawable.anquan,R.drawable.tanhua};
        List<?> images = Arrays.asList(int_image);
        mBanner.setImages(images);
        //banner设置方法全部调用完毕时最后调用
        mBanner.start();
    }


    private void initThing() {
        mStartRollCall.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                CallrollActivity.launch(AddCallRecordCallActivity.this, "3223");
            }
        });

        ll_coll_jilu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AddCallRecordCallActivity.this, CallRecordActivity.class));
            }
        });
        ll_addrecordcall_2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ToastUtils.showShort("后续开发");
            }
        });
        ll_addrecordcall_3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ToastUtils.showShort("后续开发");
            }
        });
    }


    public class GlideImageLoader extends ImageLoader {

        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            Glide.with(context).load((Integer) path).into(imageView);
        }
    }
}
